
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>8.6. isObservable · MobX 中文文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="modifiers.html" />
    
    
    <link rel="prev" href="extend-observable.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"SangKa","repo":"MobX-Docs-CN","type":"star","size":"small","count":true},{"user":"SangKa","repo":"MobX-Docs-CN","type":"fork","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    1. MobX 介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1.1" data-path="../intro/overview.html">
            
                <a href="../intro/overview.html">
            
                    
                    1.1. MobX 要点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.1.2" data-path="../intro/concepts.html">
            
                <a href="../intro/concepts.html">
            
                    
                    1.2. 概念与原则
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="api.html">
            
                <a href="api.html">
            
                    
                    2. API概览
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="observable.html">
            
                <a href="observable.html">
            
                    
                    2.1. observable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="observable-decorator.html">
            
                <a href="observable-decorator.html">
            
                    
                    2.2. @observable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="computed-decorator.html">
            
                <a href="computed-decorator.html">
            
                    
                    2.3. (@)computed
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="autorun.html">
            
                <a href="autorun.html">
            
                    
                    2.4. autorun
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="observer-component.html">
            
                <a href="observer-component.html">
            
                    
                    2.5. (@)observer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="action.html">
            
                <a href="action.html">
            
                    
                    2.6. action
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    3. Observable类型
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="object.html">
            
                <a href="object.html">
            
                    
                    3.1. objects
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="array.html">
            
                <a href="array.html">
            
                    
                    3.2. arrays
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="map.html">
            
                <a href="map.html">
            
                    
                    3.3. maps
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="boxed.html">
            
                <a href="boxed.html">
            
                    
                    3.4. boxed values
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../best/react.html">
            
                <a href="../best/react.html">
            
                    
                    4. 理解 MobX 对什么有反应
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../best/decorators.html">
            
                <a href="../best/decorators.html">
            
                    
                    5. 如何(不)使用装饰器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" >
            
                <span>
            
                    
                    6. 资源
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../faq/blogs.html">
            
                <a href="../faq/blogs.html">
            
                    
                    6.1. 教程、视频和博客
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../faq/related.html">
            
                <a href="../faq/related.html">
            
                    
                    6.2. 相关项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../faq/examples.html">
            
                <a href="../faq/examples.html">
            
                    
                    6.3. 案例项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../faq/boilerplates.html">
            
                <a href="../faq/boilerplates.html">
            
                    
                    6.4. 样板文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../faq/faq.html">
            
                <a href="../faq/faq.html">
            
                    
                    6.5. 常见问题解答
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" >
            
                <span>
            
                    
                    7. 贴士与技巧
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../best/pitfalls.html">
            
                <a href="../best/pitfalls.html">
            
                    
                    7.1. 常见陷阱与最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../best/store.html">
            
                <a href="../best/store.html">
            
                    
                    7.2. 定义数据存储
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../best/actions.html">
            
                <a href="../best/actions.html">
            
                    
                    7.3. 编写异步 actions
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../best/react-performance.html">
            
                <a href="../best/react-performance.html">
            
                    
                    7.4. 优化 React 组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../best/devtools.html">
            
                <a href="../best/devtools.html">
            
                    
                    7.5. 开发工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../best/trace.html">
            
                <a href="../best/trace.html">
            
                    
                    7.6. 使用 trace 进行调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../best/syntax.html">
            
                <a href="../best/syntax.html">
            
                    
                    7.7. ES5 / ES6 / TypeScript 语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../best/stateless-HMR.html">
            
                <a href="../best/stateless-HMR.html">
            
                    
                    7.8. 无状态组件和热加载
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                    8. 实用函数
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="autorun-async.html">
            
                <a href="autorun-async.html">
            
                    
                    8.1. autorunAsync
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="extending.html">
            
                <a href="extending.html">
            
                    
                    8.2. Atom & Reaction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="create-transformer.html">
            
                <a href="create-transformer.html">
            
                    
                    8.3. createTransformer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="expr.html">
            
                <a href="expr.html">
            
                    
                    8.4. expr
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="extend-observable.html">
            
                <a href="extend-observable.html">
            
                    
                    8.5. extendObservable
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8.6" data-path="is-observable.html">
            
                <a href="is-observable.html">
            
                    
                    8.6. isObservable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="modifiers.html">
            
                <a href="modifiers.html">
            
                    
                    8.7. modifiers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="observe.html">
            
                <a href="observe.html">
            
                    
                    8.8 intercept & observe
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="reaction.html">
            
                <a href="reaction.html">
            
                    
                    8.9. reaction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="spy.html">
            
                <a href="spy.html">
            
                    
                    8.10. spy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.11" data-path="tojson.html">
            
                <a href="tojson.html">
            
                    
                    8.11. toJS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.12" data-path="transaction.html">
            
                <a href="transaction.html">
            
                    
                    8.12. transaction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.13" data-path="untracked.html">
            
                <a href="untracked.html">
            
                    
                    8.13. untracked
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.14" data-path="when.html">
            
                <a href="when.html">
            
                    
                    8.14. when
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../donating.html">
            
                <a href="../donating.html">
            
                    
                    9. 捐赠
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >8.6. isObservable</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="isobservable"><a name="isobservable" class="plugin-anchor" href="#isobservable"><i class="fa fa-link" aria-hidden="true"></i></a>isObservable</h1>
<p>&#x5982;&#x679C;&#x7ED9;&#x5B9A;&#x503C;&#x662F;&#x901A;&#x8FC7; MobX &#x8F6C;&#x53D8;&#x6210; observable &#x7684;&#x8BDD;&#xFF0C;&#x5C31;&#x8FD4;&#x56DE; true &#x3002;
&#x53EF;&#x9009;&#x5730;&#x63A5;&#x6536;&#x7B2C;&#x4E8C;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x53C2;&#x6570;&#x7528;&#x6765;&#x53C2;&#x770B;&#x5177;&#x4F53;&#x7684;&#x5C5E;&#x6027;&#x662F;&#x5426;&#x662F; observable &#x3002;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> person = observable({
    firstName: <span class="hljs-string">&quot;Sherlock&quot;</span>,
    lastName: <span class="hljs-string">&quot;Holmes&quot;</span>
});

person.age = <span class="hljs-number">3</span>;

isObservable(person); <span class="hljs-comment">// true</span>
isObservable(person, <span class="hljs-string">&quot;firstName&quot;</span>); <span class="hljs-comment">// true</span>
isObservable(person.firstName); <span class="hljs-comment">// false (&#x53EA;&#x662F;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;)</span>
isObservable(person, <span class="hljs-string">&quot;age&quot;</span>); <span class="hljs-comment">// false</span>
</code></pre>
<h1 id="isobservablemap"><a name="isobservablemap" class="plugin-anchor" href="#isobservablemap"><i class="fa fa-link" aria-hidden="true"></i></a>isObservableMap</h1>
<p>&#x5982;&#x679C;&#x7ED9;&#x5B9A;&#x5BF9;&#x8C61;&#x662F;&#x4F7F;&#x7528; <code>mobx.map</code> &#x521B;&#x5EFA;&#x7684;&#x5219;&#x8FD4;&#x56DE; true &#x3002;</p>
<h1 id="isobservablearray"><a name="isobservablearray" class="plugin-anchor" href="#isobservablearray"><i class="fa fa-link" aria-hidden="true"></i></a>isObservableArray</h1>
<p>&#x5982;&#x679C;&#x7ED9;&#x5B9A;&#x5BF9;&#x8C61;&#x662F;&#x4F7F;&#x7528; <code>mobx.observable(array)</code> &#x8F6C;&#x53D8;&#x6210; observable &#x6570;&#x7EC4;&#x7684;&#x5219;&#x8FD4;&#x56DE; true &#x3002;</p>
<h1 id="isobservableobject"><a name="isobservableobject" class="plugin-anchor" href="#isobservableobject"><i class="fa fa-link" aria-hidden="true"></i></a>isObservableObject</h1>
<p>&#x5982;&#x679C;&#x7ED9;&#x5B9A;&#x5BF9;&#x8C61;&#x662F;&#x4F7F;&#x7528; <code>mobx.observable(object)</code> &#x8F6C;&#x53D8;&#x6210; observable &#x5BF9;&#x8C61;&#x7684;&#x5219;&#x8FD4;&#x56DE; true &#x3002;</p>
<h1 id="isboxedobservable"><a name="isboxedobservable" class="plugin-anchor" href="#isboxedobservable"><i class="fa fa-link" aria-hidden="true"></i></a>isBoxedObservable</h1>
<p>&#x63A5;&#x6536;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#xFF0C;&#x5982;&#x679C;&#x63D0;&#x4F9B;&#x7684;&#x5BF9;&#x8C61;&#x662F;&#x4E00;&#x4E2A;&#x88C5;&#x7BB1;&#x7684; observable &#x5219;&#x8FD4;&#x56DE; true &#x3002;&#x6CE8;&#x610F;&#x5BF9;&#x4E8E;&#x88C5;&#x7BB1;&#x7684;&#x8BA1;&#x7B97;&#x503C;&#x4E0D;&#x8FD4;&#x56DE; true &#x3002;</p>
<h1 id="iscomputed"><a name="iscomputed" class="plugin-anchor" href="#iscomputed"><i class="fa fa-link" aria-hidden="true"></i></a>isComputed</h1>
<p>Accepts an <code>object</code> and optional <code>propertyName</code> argument. Returns <code>true</code> if either:
&#x63A5;&#x6536; <code>object</code> &#x548C;&#x53EF;&#x9009;&#x7684; <code>propertyName</code> &#x53C2;&#x6570;&#x3002;&#x5982;&#x679C;&#x662F;&#x4E0B;&#x9762;&#x5176;&#x4E2D;&#x4E00;&#x79CD;&#x60C5;&#x51B5;&#x5219;&#x8FD4;&#x56DE; <code>true</code>&#xFF1A;</p>
<ul>
<li>&#x4F20;&#x5165;&#x7684; <code>object</code> &#x662F;&#x88C5;&#x7BB1;&#x7684;&#x8BA1;&#x7B97;&#x5C5E;&#x6027;</li>
<li>&#x5982;&#x679C; <code>object</code> &#x7684; <code>propertyName</code> &#x5C5E;&#x6027;&#x662F;&#x8BA1;&#x7B97;&#x5C5E;&#x6027;&#x3002;</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="extend-observable.html" class="navigation navigation-prev " aria-label="Previous page: 8.5. extendObservable">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="modifiers.html" class="navigation navigation-next " aria-label="Next page: 8.7. modifiers">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"8.6. isObservable","level":"1.8.6","depth":2,"next":{"title":"8.7. modifiers","level":"1.8.7","depth":2,"path":"refguide/modifiers.md","ref":"refguide/modifiers.md","articles":[]},"previous":{"title":"8.5. extendObservable","level":"1.8.5","depth":2,"path":"refguide/extend-observable.md","ref":"refguide/extend-observable.md","articles":[]},"dir":"ltr"},"config":{"plugins":["github","edit-link","anchors","copy-code-button","github-buttons"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"github":{"url":"https://github.com/SangKa/mobx-docs-cn"},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"github-buttons":{"buttons":[{"user":"SangKa","repo":"MobX-Docs-CN","type":"star","size":"small","count":true},{"user":"SangKa","repo":"MobX-Docs-CN","type":"fork","size":"small","count":true}]},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"完善文档","base":"https://github.com/SangKa/mobx-docs-cn/tree/master/docs"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"MobX 中文文档","gitbook":"3.2.2"},"file":{"path":"refguide/is-observable.md","mtime":"2018-01-25T08:58:26.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-09T16:05:28.236Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

